<template>
  <div class="test">测试页面</div>
  <ul>
    <li>{{ store.user }}</li>
    <li @click="changeUser">修改user</li>
    <li></li>
  </ul>
  <hr />
  <van-button type="primary">主要按钮</van-button>
  <van-button type="success">成功按钮</van-button>
  <van-button type="default">默认按钮</van-button>
  <van-button type="danger">危险按钮</van-button>
  <van-button type="warning">警告按钮</van-button>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useUserStore } from '@/stores'
import { request } from '@/utils/request'

const store = useUserStore()

const changeUser = () => {
  store.setUser({
    id: '1',
    token: '123',
    account: '',
    mobile: '12345678',
    avatar: '',
  })
}

const getHome = async () => {
  const res = await request.get('/patient/myUser')
  console.log(res)
}

const login = async () => {
  const res = await request.post('/login/password', {
    mobile: '13211112222',
    password: 'abc12345',
  })
  console.log('登录成功:', res)
}

onMounted(() => {
  // getHome()
  login()
})
</script>

<style scoped>
.test {
  font-size: 16px;
  border: 2px solid red;
}
</style>
